Skip to main content

Troubleshooting Common OpenAPI Spec Issues

# Common OpenAPI Spec Problems

## String Columns Too Large

Currently, there are some boundary issues when choosing values for string "maxLength". Some databases only support creation of VARCHAR columns which are limited to approximately 16k characters in length. When trying to create a 20k size character column, it fails to 'upcast' to a larger 'text' type.

```yaml
...
bioUrl:
type: string
description: More in-depth information about you and your account
maxLength: 20000
...

The workaround is to choose a significantly higher size which will force the properly sized column:

...
bioUrl:
type: string
description: More in-depth information about you and your account
maxLength: 100000
...

Non-Fatal Test Errors

During Maven test runs, you may encounter Spring JPA DML/DDL issues creating tables for tests using the H2 embedded database engine. These may or may not impact your testing depending upon whether your test code touches upon the tables that are not able to be created.

Duplicating Generated Props

You must avoid manually adding duplicate auto-generated fields like id or created_date to your OpenAPI spec. ThorAPI may or may not dedupe the spec properly, and this will likely introduce potential bugs and malfunctioning of the code that depends on these fields.

Unsupported OpenAPI Features

Check for unsupported features in your OpenAPI spec that may lead to errors during code generation or runtime.

Validation Conflicts

Check for conflicting validation rules in your OpenAPI spec that may prevent data from being processed correctly.

For example:

        someData:
maxLength: 10
minLength: 20
type: string
description: this is broken data cannot be inserted

Missing Required Fields

Ensure all required fields are properly specified in your OpenAPI spec and database schema.